
%          figure(1)
         switch schemenumber
             
             
                          
             case 35
                 
                 for jj = 1:nf
                 subplot(2,nf,jj)
                 plot(means(jj)+ 3*nanmean(Draws_Factors(:,jj,:),3),':r');
                 hold on
                 plot(means(jj)+ 3*nanmean(Draws_Factors(:,jj,:),3)+ 3*nanmean(Draws_Factors(:,trend+jj,:),3),'r');
                 plot(means(jj)+ 3*nanmean(Draws_Factors(:,jj,:),3)+ 3*nanmean(Draws_Factors(:,trend+jj,:),3)+ 3*nanmean(Draws_Idiosyncratic(:,jj,:),3),'b');
                 hold off
                 
                 subplot(2,nf,jj+nf)
                 trend_percentiles = means(jj) + 3*prctile(squeeze(Draws_Factors(:,jj,:)),[5,16,50,84,95],2);
                 plot(trend_percentiles(:,3),'r')
                 hold on
                 plot(trend_percentiles(:,[2,4]),'b')
                 plot(trend_percentiles(:,[1,5]),':b')
                 hold off

                 end
                 
                 pause(0.001)
             
             case 3
                 
                 for jj = 1:nf
                 subplot(1,nf,jj)
                 plot(means(1)+ 3*nanmean(Draws_Factors(:,jj,:),3),'r');
                 hold on
                 plot(means(1)+ 3*nanmean(Draws_Factors(:,jj,:),3)+ 3*nanmean(Draws_Idiosyncratic(:,jj,:),3),'b');
                 hold off
                 end
                 
                 pause(0.001)
                 
                 
                 
                 
             case 102
                  quarterly_factors = [nanmean(Draws_Factors(:,trend+1:end,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:end,:),3),4)]*[1/3 2/3 1 2/3 1/3]';

                 
         subplot(2,2,1)
         plot(nanmean(Draws_Forecasts(:,1,:),3),':black')
         hold on
         plot(means(1)+quarterly_factors,'blue')        
         plot(means(1)+3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3),'r');
         hold off
         title('Output')

         subplot(2,2,2)
         plot(nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(2)+nanmean(Draws_lambda(2,3,:),3)*quarterly_factors,'blue')        
         
         plot(means(2)+ 3*nanmean(sum(Draws_Factors(:,2,:),2),3),'r');
         hold off         
         title('Hours')
         
         subplot(2,2,3)
         plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'r');
         hold off  
         title('Productivity')
         

         trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:2,:),2)),[10,32,50,68,90],2);
         subplot(2,2,4)
         plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         plot(means(2)+3*nanmean(Draws_Factors(:,2,:),3),'g');
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'k');
         plot(means(2)+3*nanmean(Draws_Factors(:,2,:),3)+means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'k');
         hold off
        
             case 103
                              quarterly_factors = [nanmean(Draws_Factors(:,trend+1:end,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:end,:),3),4)]*[1/3 2/3 1 2/3 1/3]';

         subplot(2,2,1)
         plot(nanmean(Draws_Forecasts(:,1,:),3),':black')
         hold on
         plot(means(1)+quarterly_factors,'blue')        
         plot(means(1)+3*nanmean(sum(Draws_Factors(:,1,:),2),3),'r');
         hold off
         title('Output')

         subplot(2,2,2)
         plot(nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(2)+nanmean(Draws_lambda(2,3,:),3)*quarterly_factors,'blue')        
         
         plot(means(2)+ 3*nanmean(Draws_Factors(:,2,:),3),'r');
         hold off         
         title('Hours')
         
         subplot(2,2,3)
         plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3)-3*nanmean(Draws_Factors(:,2,:),3),'r');
         hold off  
         title('Productivity')
         

         trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1,:),2)),[5,16,50,84,95],2);
         subplot(2,2,4)
         plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         plot(means(2)+3*nanmean(Draws_Factors(:,2,:),3),'g');
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3)-3*nanmean(Draws_Factors(:,2,:),3),'k');
         hold off             
             
             case {5,6,51,52}
                 
                 
                 
                 if trend > 0
                     
                     for jj = 1:trend
                         
                         annualise = VarTypeInd(jj)>99;
                         subplot(2+SV_factors,trend,jj)
                         plot(means(jj)+ (1+annualise*2)*(1+standardise*(stdevs(jj)-1))*nanmean(Draws_Factors(:,jj,:),3),':r');
                         hold on
                         plot(means(jj)+ (1+standardise*(stdevs(jj)-1))*(1+annualise*2)*(nanmean(Draws_Factors(:,jj,:),3)+nanmean(Draws_lambda(jj,trend+1:trend+nf,:),3)*nanmean(Draws_Factors(:,trend+1:trend+nf,:),3)),'r');
                         plot(means(jj)+ (1+standardise*(stdevs(jj)-1))*(1+annualise*2)*(nanmean(Draws_Factors(:,jj,:),3)...
                                       + nanmean(Draws_lambda(jj,trend+1:trend+nf,:),3)*nanmean(Draws_Factors(:,trend+1:trend+nf,:),3) ...
                                       + nanmean(Draws_Idiosyncratic(:,jj,:),3)),'b');
                         hold off
                         title('In-Sample Fit of GDP')
                                   
                                   
                         subplot(2+SV_factors,trend,trend+jj)
                         trend_percentiles = means(jj) + (1+annualise*2)*(1+standardise*(stdevs(jj)-1))*prctile(squeeze(Draws_Factors(:,jj,:)),[5,16,50,84,95],2);
                         plot(trend_percentiles(:,3),'r')
                            hold on
                            plot(trend_percentiles(:,[2,4]),'b')
                            plot(trend_percentiles(:,[1,5]),':b')
                            hold off
                            title('Posterior Estimate of Trend Growth')
                            
                            
                         cycle_percentiles =(1+annualise*2)*(1+standardise*(stdevs(jj)-1))*prctile(squeeze(Draws_Factors(:,trend+1,:)),[5,16,50,84,95],2);
                            
                        if SV_factors == 1
                            
                            subplot(2+SV_factors,1,3)
                            variance_factor = ((1-nanmean(Draws_phi(1,2,:),3))/(1+nanmean(Draws_phi(1,2,:),3)))/((1-nanmean(Draws_phi(1,2,:),3))^2-nanmean(Draws_phi(1,1,:),3)^2);
                            sd_factor = 3*sqrt(variance_factor*(nanmean(squeeze(Draws_Sigma_epsilon(1,1,:,:)),2)));                           
                            sd_percentiles = 3*sqrt(variance_factor*(prctile(squeeze(Draws_Sigma_epsilon(1,1,:,:)),[5,16,50,84,95],2)));
                            plot(sd_factor,'r');
                            hold on
                            plot(sd_percentiles(:,[2,4]),'b')
                            plot(sd_percentiles(:,[1,5]),':b')                            
                            hold off
                            title('Volatiliy of Common Factor');                            
                            
                        end

                     end
                     
                              
                     
                 else
                 

%                                              plot(nanmean(Draws_Factors(:,:,:),3));
                 subplot(1,2,1)
                 plot(repmat(means(1),Tstar,1),':r'); 
                 hold on
                 plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:),3),'r');
                 plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:),3)+ 3*nanmean(Draws_Idiosyncratic(:,1,:),3),'b');
                 hold off
                 
                     title('GDP growth, common factor, and forecasts')
                    subplot(1,2,2)
                    trend_percentiles = means(1) + 3*prctile(squeeze(Draws_Factors(:,1,:)),[5,16,50,84,95],2);
                    plot(trend_percentiles(:,3),'r')
                    hold on
                    plot(trend_percentiles(:,[2,4]),'b')
                    plot(trend_percentiles(:,[1,5]),':b')
                    hold off
                    title('Posterior Estimate of Trend Growth')
                 end
%          datetick
         
         case 7
                 

%                                              plot(nanmean(Draws_Factors(:,:,:),3));
            subplot(1,2,1)
         if trend == 1
         plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:),3),':r');
         hold on
         plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3),'r');
         plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3) + 3*nanmean(Draws_Idiosyncratic(:,1,:),3),'b');

         hold off
         else
         plot(repmat(means(1),Tstar,1),':r'); 
         hold on
         plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:),3),'r');
         plot(means(1)+ 3*nanmean(Draws_Factors(:,1,:),3)+ 3*nanmean(Draws_Idiosyncratic(:,1,:),3),'b');
         hold off
         end
         legend('Underlying Factor','Interpolated Monthly GDP')
% 
        subplot(1,2,2)
        trend_percentiles = means(1) + 3*prctile(squeeze(Draws_Factors(:,1,:)),[5,16,50,84,95],2);
        plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         hold off
         
         case 201
                  quarterly_factors = [nanmean(Draws_Factors(:,trend+1:end,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:end,:),3),4)]*[1/3 2/3 1 2/3 1/3]';

                 
         subplot(2,2,1)
         plot(nanmean(Draws_Forecasts(:,1,:),3),':black')
         hold on
         plot(means(1)+quarterly_factors,'blue')        
         plot(means(1)+3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3),'r');
         hold off
         title('Output')

         subplot(2,2,2)
         plot(nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(2)+nanmean(Draws_lambda(2,2,:),3)*quarterly_factors,'blue')        
         
         plot(means(3)+ 3*nanmean(sum(Draws_Factors(:,2,:),2),3),'r');
         hold off         
         title('Hours')
         
         subplot(2,2,3)
         plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'r');
         hold off  
         title('Productivity')
         

         trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:2,:),2)),[10,32,50,68,90],2);
         subplot(2,2,4)
         plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         plot(means(2)+3*nanmean(Draws_Factors(:,2,:),3),'g');
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'k');
         hold off         
         
         
         case {202, 204, 2021}
          quarterly_factors = [nanmean(Draws_Factors(:,trend+1:trend+nf,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:trend+nf,:),3),4)]*[1/3 2/3 1 2/3 1/3]';

                 
         subplot(2,2,1)
         plot(nanmean(Draws_Forecasts(:,1,:),3),'black')
         hold on
         plot(quarterly_factors,'blue')        
         plot(means(1)+3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3),'r');
         hold off
         title('Output')

         subplot(2,2,2)
         plot(nanmean(Draws_Forecasts(:,3,:),3),'black')
         hold on
         plot(nanmean(Draws_lambda(3,3,:),3)*quarterly_factors,'blue')        
         
         plot(means(3)+ 3*nanmean(sum(Draws_Factors(:,2,:),2),3),'r');
         hold off         
         title('Hours')
         
         subplot(2,2,3)
         plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,3,:),3),'black')
         hold on
         plot(means(1)-means(3)+3*nanmean(Draws_Factors(:,1,:),3),'r');
         hold off  
         title('Productivity')
         

         trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:2,:),2)),[10,32,50,68,90],2);
         subplot(2,2,4)
         plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         plot(means(3)+3*nanmean(Draws_Factors(:,2,:),3),'g');
         plot(means(1)-means(3)+3*nanmean(Draws_Factors(:,1,:),3),'k');
         hold off
         
             case 2001
                 
             quarterly_factors = [nanmean(Draws_Factors(:,trend+1:trend+nf,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:trend+nf,:),3),4)]*[1/3 2/3 1 2/3 1/3]';            
             trends = 3*(nanmean(Draws_Factors(:,1:trend,:),3)*nanmean(Draws_lambda(1:4,1:trend,:),3)');            

             subplot(2,3,1)
             plot(nanmean(Draws_Forecasts(:,1,:),3),'black')
             hold on
             fittedtrend = means(1)+trends(:,1);
             cycle = fittedtrend + nanmean(Draws_lambda(1,trend+1,:),3)*quarterly_factors;
             plot(cycle,'blue','LineWidth',1.5)        
             plot(fittedtrend,'r','LineWidth',1.5);
             hold off
             title('Output')
             
             subplot(2,3,2)
             plot(nanmean(Draws_Forecasts(:,2,:),3),'black')
             hold on
             fittedtrend = means(2)+trends(:,2);
             cycle = fittedtrend + nanmean(Draws_lambda(2,trend+1,:),3)*quarterly_factors;
             plot(cycle,'blue','LineWidth',1.5)        
             plot(fittedtrend,'r','LineWidth',1.5);
             hold off
             title('Consumption')      
             
             subplot(2,3,3)
             plot(nanmean(Draws_Forecasts(:,3,:),3),'black')
             hold on
             fittedtrend = means(3)+trends(:,3);
             cycle = fittedtrend + nanmean(Draws_lambda(3,trend+1,:),3)*quarterly_factors;
             plot(cycle,'blue','LineWidth',1.5)        
             plot(fittedtrend,'r','LineWidth',1.5);
             hold off
             title('TFP')   
             
             subplot(2,3,4)
             plot(nanmean(Draws_Forecasts(:,4,:),3),'black')
             hold on
             fittedtrend = means(4)+trends(:,4);
             cycle = fittedtrend + nanmean(Draws_lambda(4,trend+1,:),3)*quarterly_factors;
             plot(cycle,'blue','LineWidth',1.5)        
             plot(fittedtrend,'r','LineWidth',1.5);
             hold off
             title('Hours')  
             
             subplot(2,3,5)
             plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,4,:),3),'black')
             hold on
             fittedtrend= means(1)-means(2)+nanmean(Draws_Factors(:,1,:),3)+nanmean(Draws_Factors(:,2,:),3);
             fittedtrend1 = means(1)-means(2)+nanmean(Draws_Factors(:,1,:),3);
             
             cycle = fittedtrend + nanmean(Draws_lambda(4,trend+1,:),3)*quarterly_factors;
             plot(cycle,'blue','LineWidth',1.5)        
             plot(fittedtrend,'r','LineWidth',1.5);
             plot(fittedtrend1,':r','LineWidth',1.5);
             hold off
             title('Hours')  
             
             subplot(2,3,6)
             trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:trend,:),2)),[10,32,50,68,90],2);
             plot(trend_percentiles(:,3),'r')
             hold on
             plot(trend_percentiles(:,[2,4]),'b')
             plot(trend_percentiles(:,[1,5]),':b')
             
             plot(means(1)-means(4)+3*nanmean(Draws_Factors(:,1,:),3))
             plot(3*nanmean(Draws_Factors(:,2,:),3),':')
             plot(means(4)+3*nanmean(Draws_Factors(:,3,:),3))
             hold off

      case 20012
                 
        meanfactors = nanmean(Draws_Factors(:,:,:),3);
        meanloadings = nanmean(Draws_lambda(:,:,:),3);
        fittedvariables = meanfactors*meanloadings';
        meanidiosyncratic = nanmean(Draws_Idiosyncratic(:,:,:),3);
        
        quarterly_factors = [nanmean(Draws_Factors(:,trend+1:trend+nf,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:trend+nf,:),3),4)]*[1/3 2/3 1 2/3 1/3]';            

        if trend > 0
        lambdatrends = nanmean(Draws_lambda(1:5,1:trend,:),3);            

        trends = 3*(nanmean(Draws_Factors(:,1:trend,:),3)*lambdatrends');            
    
 
        thing = (Draws_Factors(:,1:trend,:));
        thing2 = (Draws_lambda(1,1:trend,:));
        thing3 = nan(Tstar,1,nsave);
        for jj = 1:nsave
            thing3(:,:,jj) = thing(:,:,jj)*thing2(:,:,jj)';
        end
        
        trend_percentiles = means(1) + 3*prctile(squeeze(thing3(:,1,:)),[5,16,50,84,95],2);


        end          
          
        names = {'Output','Income','Consumption','TFP','Hours'};
        
        for i = 1:5
            
            subplot(2,3,i)
            plot(nanmean(Draws_Forecasts(:,i,:),3),'black')
            hold on
            fittedtrend = means(i)+trends(:,i);
            cycle =  means(i) + meanloadings(i,trend+1)*quarterly_factors;
            
            plot(cycle,'blue','LineWidth',1.5)        
            plot(fittedtrend,'r','LineWidth',1.5);
            hold off
            title(names(i));

            
        end
          
             subplot(2,3,6)
             trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:trend,:),2)),[10,32,50,68,90],2);
             plot(trend_percentiles(:,3),'r')
             hold on
             plot(trend_percentiles(:,[2,4]),'b')
             plot(trend_percentiles(:,[1,5]),':b')
             
             plot(means(4)+3*nanmean(Draws_Factors(:,1,:),3))
             plot(means(1)-means(4)+3*nanmean(Draws_Factors(:,2,:),3),':')
             plot(means(5)+3*nanmean(Draws_Factors(:,3,:),3))
             hold off             
%              
             
         case 203
         quarterly_factors = [nanmean(Draws_Factors(:,trend+1:end,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:end,:),3),4)]*[1/3 2/3 1 2/3 1/3]';

                 
         subplot(2,2,1)
         plot(nanmean(Draws_Forecasts(:,1,:),3),':black')
         hold on
         plot(means(1)+quarterly_factors,'blue')        
         plot(means(1)+3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3),'r');
         hold off
         title('Output')

         subplot(2,2,2)
         plot(nanmean(Draws_Forecasts(:,4,:),3),'black')
         hold on
         plot(means(4)+nanmean(Draws_lambda(4,3,:),3)*quarterly_factors,'blue')        
         
         plot(means(4)+ 3*nanmean(sum(Draws_Factors(:,2,:),2),3),'r');
         hold off         
         title('Hours')
         
         subplot(2,2,3)
         plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,4,:),3),'black')
         hold on
         plot(means(1)-means(4)+3*nanmean(Draws_Factors(:,1,:),3),'r');
         hold off  
         title('Productivity')
         

         trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:2,:),2)),[10,32,50,68,90],2);
         subplot(2,2,4)
         plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         plot(means(4)+3*nanmean(Draws_Factors(:,2,:),3),'g');
         plot(means(1)-means(4)+3*nanmean(Draws_Factors(:,1,:),3),'k');
         hold off         
         
              
         case 204
         quarterly_factors = [nanmean(Draws_Factors(:,trend+1:end,:),3) mlag2(nanmean(Draws_Factors(:,trend+1:end,:),3),4)]*[1/3 2/3 1 2/3 1/3]';

                 
         subplot(2,2,1)
         plot(nanmean(Draws_Forecasts(:,1,:),3),':black')
         hold on
         plot(means(1)+quarterly_factors,'blue')        
         plot(means(1)+3*nanmean(Draws_Factors(:,1,:)+Draws_Factors(:,2,:),3),'r');
         hold off
         title('Output')

         subplot(2,2,2)
         plot(nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(2)+nanmean(Draws_lambda(2,3,:),3)*quarterly_factors,'blue')        
         
         plot(means(2)+ 3*nanmean(sum(Draws_Factors(:,2,:),2),3),'r');
         hold off         
         title('Hours')
         
         subplot(2,2,3)
         plot(nanmean(Draws_Forecasts(:,1,:),3)-nanmean(Draws_Forecasts(:,2,:),3),'black')
         hold on
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'r');
         hold off  
         title('Productivity')
         

         trend_percentiles = means(1) + 3*prctile(squeeze(sum(Draws_Factors(:,1:2,:),2)),[5,16,50,84,95],2);
         subplot(2,2,4)
         plot(trend_percentiles(:,3),'r')
         hold on
         plot(trend_percentiles(:,[2,4]),'b')
         plot(trend_percentiles(:,[1,5]),':b')
         plot(means(2)+3*nanmean(Draws_Factors(:,2,:),3),'g');
         plot(means(1)-means(2)+3*nanmean(Draws_Factors(:,1,:),3),'k');
         hold off
         
         case 1

             if trend == 1
                 meanfactors = nanmean(Draws_Factors(:,trend+1:trend+nf,:),3);
                 trend_gdp = nanmean(Draws_Factors(:,1,:),3);
                 underlying_gdp = trend_gdp + [meanfactors mlag2(meanfactors,s)]*nanmean(Draws_lambda(1,:,:),3)';
                 monthly_gdp = (underlying_gdp + nanmean(Draws_Idiosyncratic(:,1,:),3));
                 
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*monthly_gdp,'color',[0,0.7,0.9]);
                 hold on
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*(trend_gdp+meanfactors),'r','LineWidth',2);                
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*trend_gdp,':r');
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*underlying_gdp,':b','LineWidth',1.5);
                 
                 hold off
             else
                 meanfactors = nanmean(Draws_Factors(:,trend+1:trend+nf,:),3);
                 trend_gdp = zeros(Tstar,1);
                 underlying_gdp = trend_gdp + [meanfactors mlag2(meanfactors,s)]*nanmean(Draws_lambda(1,:,:),3)';
                 monthly_gdp = (underlying_gdp + nanmean(Draws_Idiosyncratic(:,1,:),3));
                 
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*monthly_gdp,'b');
                 hold on
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*(trend_gdp+meanfactors),'r');                
                 plot(means(1) + 3*(1+standardise*(stdevs(1)-1))*trend_gdp,':r');
                 
                 hold off
             end
             legend('Underlying Factor','Interpolated Monthly GDP')  
         
         
         case 12
         
         subplot(1,2,1)    
         plot(nanmean(Draws_Factors(:,:,:),3));
         legend('Level','Factor 2','Factor 3')

         subplot(1,2,2)
         plot(nanmean(Draws_lambda(:,:,1:nrep-nburn),3))
         
         end         
         
         
         pause(0.001)